// pages/components/pay/x.js
const api = require('../../../utils/request')
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    isSuccess:false, //是否验证成功
    score: '',
    newPassword:''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    hideClose() {
      this.triggerEvent('close',this.data.isSuccess)
    },
    
    scoreInput(e) {
      const val = e.detail.value;
      this.setData({
        score: val,
      });
    },
    newPasswordInput(e) {
      const val = e.detail.value;
      this.setData({
        newPassword: val,
      });
    },
    setStep() {
      let _this = this
      api._post('/api?method=point.create_hexiao', {
        point_num: _this.data.score
      },'noload').then(res => {
          _this.setData({
            newPassword: res.data.hexiao_code,
            isSuccess: true
          })
      })
    }
  }
})